<%@ page import="com.test.pojo.People" %><%--
  Created by IntelliJ IDEA.
  User: 曾幼九
  Date: 2023/3/5
  Time: 22:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>JavaBean演示</title>
</head>
<body>

<%
    People people2 = new People();
    people2.setAddress("上海");
    people2.setAge(22);
    people2.setName("Jack");
    people2.setId(2);
%>


<jsp:useBean id="people1" class="com.test.pojo.People" scope="page"/>
<jsp:setProperty name="people1" property="address" value="北京"/>
<jsp:setProperty name="people1" property="id" value="1"/>
<jsp:setProperty name="people1" property="age" value="20"/>
<jsp:setProperty name="people1" property="name" value="Tom"/>

<%--  <%=people.getAddress()%>  --%>

<%--姓名: <jsp:getProperty name="people1" property="name"/>--%>
<%--<br>--%>
<%--id: <jsp:getProperty name="people1" property="id"/>--%>
<%--<br>--%>
<%--年龄: <jsp:getProperty name="people1" property="age"/>--%>
<%--<br>--%>
<%--地址: <jsp:getProperty name="people1" property="address"/>--%>
姓名: <%=people2.getName()%>
<br>
id: <%=people2.getId()%>
<br>
年龄: <%=people2.getAge()%>
<br>
地址: <%=people2.getAddress()%>

</body>
</html>
